package com.wman.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import com.wman.sheep.common.utils.DensityUtil;

import androidx.annotation.Nullable;

/**
 * @ProjectName: wman
 * @Package: com.wman
 * @ClassName: CountryView
 * @Description: java类作用描述
 * @Author: wman
 * @CreateDate: 2019/11/8 17:22
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/11/8 17:22
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class CityView extends View {
    private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    private String city = "成都";

    public CityView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    {
        mPaint.setTextSize(DensityUtil.dip2px(50));
        mPaint.setTextAlign(Paint.Align.CENTER);
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
        invalidate();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        canvas.drawText(city, getWidth() / 2, getHeight() / 2, mPaint);
    }
}
